package 网络编程;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class UdpServer {
    public static void main(String[] args) throws Exception {
        //创建端口号
        DatagramSocket socket=new DatagramSocket(8899);
        //接收包
        byte [] bus=new byte[1024];
        DatagramPacket packet=new DatagramPacket(bus,0,bus.length);
        //接收堵塞
        socket.receive(packet);
        //输出内容
        System.out.println(new String(packet.getData(),0, packet.getLength()));
        socket.close();
    }
}
